home *** CD-ROM | disk | FTP | other *** search
/ Enter 2006 October / Enter 10 2006.iso / boot / isolinux / initrd / in / usr / lib / setup / SeTbootloader < prev    next >
Encoding:
Text File  |  2006-07-31  |  5.3 KB  |  181 lines

  1. #!/bin/sh
  2. TMP=/var/log/setup/tmp
  3. T_PX=`cat $TMP/SeTT_PX`
  4. ROOT_DEVICE=`cat $TMP/SeTrootdev`
  5. export TEXTDOMAIN=SeTbootloader
  6.  
  7. # A function to ask for append= parameters. 
  8. ask_append(){
  9.    dialog --title "`gettext -e "OPTIONAL LILO append=<kernel perameters> LINE"`" --no-cancel --inputbox \
  10. "`gettext -e "Some systems might require extra parameters to be passed to the kernel. \
  11. If you needed to pass parameters to the kernel when you booted the Kate \
  12. bootdisk, you'll probably want to enter the same ones here.  Most \
  13. systems won't require any extra parameters.  If you don't need any, just \
  14. hit ENTER to continue.\n\
  15. \n"`" 13 72 2> $TMP/reply
  16.     RETVAL=$?
  17.     return $RETVAL
  18. }
  19.  
  20.  
  21.  
  22. if test ! -f $T_PX/sbin/lilo ; then
  23. dialog --title "LILO NOT FOUND" --msgbox "LILO was not found on your system ! \ 
  24. You should always remember to install lilo package ! Your Kate OS system will not \
  25. boot without bootloader !"  10 72
  26. exit 
  27. fi
  28.  
  29. dialog --title "`gettext "SELECT LILO TARGET LOCATION"`" $DEFAULT --menu "`gettext "LILO can be installed \
  30. to a variety of places: the master boot record of your first hard drive, \
  31. the superblock of your root Linux partition (which could then be made the \
  32. bootable partition with fdisk), a formatted floppy disk, \
  33. or the master boot record of your first hard drive. If you're using \
  34. a boot system such as Boot Manager, you should use the 'Root' \
  35. selection. Please pick a target location:"`" 16 65 3 \
  36. "Root" "`gettext "Install to superblock (not for use with XFS)"`" \
  37. "Floppy" "`gettext "Use a formatted floppy disk in the boot drive"`" \
  38. "MBR" "`gettext "Use the Master Boot Record"`" \
  39. 2> $TMP/reply
  40.  if [ $? = 1 -o $? = 255 ]; then
  41.   exit
  42.  fi
  43. TG="`cat $TMP/reply`"
  44. rm -r $TMP/reply
  45.  
  46.   if [ "$TG" = "`gettext "MBR"`" ]; then
  47.    LILO_TARGET=`cat $TMP/SeTrootdev | cut -c 1-8`
  48.   fi
  49.  
  50.   if [ "$TG" = "`gettext "Root"`" ]; then
  51.    LILO_TARGET=`cat $TMP/SeTrootdev`
  52.   fi
  53.  
  54.   if [ "$TG" = "`gettext "Floppy"`" ]; then
  55.    LILO_TARGET="/dev/fd0"
  56.   fi
  57. while [ 1 ] ; do
  58.    dialog --title "`gettext "CONFIRM LOCATION TO INSTALL LILO"`" --no-cancel --inputbox \
  59. "`gettext "The auto-detected location to install the LILO boot block is shown below.  \
  60. If you need to make any changes, you can make them below.  Otherwise, hit \
  61. ENTER to accept the target location shown."`" 11 60 $LILO_TARGET 2> $TMP/reply
  62.     if [ $? = 0 ]; then
  63.       LILO_TARGET="`cat $TMP/reply`"
  64.        if [ -b $LILO_TARGET ] ; then 
  65.        break
  66.        else
  67.       LILO_TARGET=""
  68.       dialog --title "`gettext "ERROR"`" --msgbox \
  69.   "`gettext "Selected device doesn't exist ! TRY AGAIN"`" 6 40
  70.     rm -rf $TMP/reply    
  71.        fi 
  72.     fi
  73. done
  74.  
  75. CONSOLENUM=791
  76.  
  77.  
  78.  ask_append;
  79.  if [ $? = 1 -o $? = 255 ]; then
  80.   unset APPEND
  81.  fi
  82.  APPEND="`cat $TMP/reply`"
  83.  
  84.  cat << EOF > $T_PX/etc/lilo.conf
  85. # LILO configuration file
  86. #
  87. # Start LILO global section
  88. EOF
  89.  
  90. if [ ! "$APPEND" = "" ]; then
  91.      echo "append=\"$APPEND\"" >> $T_PX/etc/lilo.conf
  92. fi
  93.  
  94. echo "boot = $LILO_TARGET" >> $T_PX/etc/lilo.conf
  95. echo "`cat $T_PX/boot/kateoslogo.dat`" >> $T_PX/etc/lilo.conf
  96.  
  97. cat << EOF >> $T_PX/etc/lilo.conf
  98. prompt
  99. timeout = 1200
  100. # Override dangerous defaults that rewrite the partition table:
  101. change-rules
  102.   reset
  103. EOF
  104.  
  105. cat << EOF >> $T_PX/etc/lilo.conf
  106. # End LILO global section
  107. # Linux root partition section
  108. image = /boot/vmlinuz
  109.  root = $ROOT_DEVICE
  110.  label = KateOS
  111.  initrd = /boot/initrd
  112.  vga=791
  113.  append="$APPEND splash=silent quiet"
  114.  read-only
  115.  
  116. image = /boot/vmlinuz
  117.  root = $ROOT_DEVICE
  118.  label = KateOS_verbose
  119.  initrd = /boot/initrd
  120.  vga=791
  121.  append="$APPEND splash=off"
  122.  read-only
  123.  
  124. image = /boot/vmlinuz
  125.  root = $ROOT_DEVICE
  126.  label = KateOS_failsafe
  127.  initrd = /boot/initrd
  128.  vga=normal
  129.  append="$APPEND splash=off ide=nodma noapic noapm acpi=off noudev"
  130.  read-only
  131.  
  132. # End root Linux partition section
  133. EOF
  134.  
  135.  
  136.  
  137. WINDEVICE="/dev/hda1 /dev/hda2 /dev/hdb1 /dev/hdb2 /dev/hdc1 /dev/hdc2 /dev/hdd1 \
  138. /dev/hdd2 /dev/hde1 /dev/hde2 /dev/sda1 /dev/sda2 /dev/sdb1 /dev/sdb2 /dev/sdc1 /dev/sdc2 \
  139. /dev/sdd1 /dev/sdd2 /dev/sde1 /dev/sde2 /dev/sdf1 /dev/sdf2"
  140. mkdir $TMP/windev
  141. for device in $WINDEVICE ; do
  142. mount $device $TMP/windev 1>/dev/null 2>/dev/null
  143. if [ -d $TMP/windev/windows ] && [ -f $TMP/windev/windows/notepad.exe ] ; then
  144. TABLE="`echo $device | cut -c 1-8`"
  145. cat << EOF >> $T_PX/etc/lilo.conf
  146. # Windows bootable partition config begins
  147.   other = $device
  148.   label = Windows
  149.   table = $TABLE
  150. # Windows bootable partition config ends
  151. EOF
  152.  
  153. fi
  154. umount $TMP/windev 1>/dev/null 2>/dev/null
  155. done
  156. rm -rf $TMP/windev
  157.  
  158. cat << EOF > $T_PX/boot/boot_message.txt
  159.  
  160. Welcome to the LILO Boot Loader!
  161.  
  162. EOF
  163.  
  164. chroot $T_PX mount /proc 1>/dev/null 2>/dev/null
  165. chroot $T_PX lilo -m /boot/map -C /etc/lilo.conf 1>/dev/null 2>/dev/null
  166. SUCCESS=$?
  167. chroot $T_PX umount /proc 1>/dev/null 2>/dev/null
  168. if [ ! "$SUCCESS" = "0" ]; then # some LILO error occured
  169.   dialog --title "`gettext "LILO INSTALL ERROR #"`$SUCCESS" --msgbox \
  170.   "`gettext "Sorry, but the attempt to install LILO has returned an error, so LILO \
  171. has not been correctly installed.  You'll have to use a bootdisk \
  172. to start your \
  173. machine instead.  It should still be possible to get LILO working by \
  174. editing the /etc/lilo.conf and reinstalling LILO manually.  See the \
  175. LILO man page and documentation in /usr/doc/lilo/ for more help."`" 11 60
  176. else
  177.   dialog --title "`gettext "LILO INSTALLED SUCCESFULLY"`" --msgbox \
  178.  "`gettext "Your bootloader was installed successfully."`" 0 0
  179.  
  180.  fi
  181.